load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
    name = "kvserverpb",
    srcs = [
        "lease_status.go",
        "log.go",
        "proposer_kv.go",
        "raft.go",
        "state.go",
    ],
    embed = [":kvserverpb_go_proto"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvserverpb",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/roachpb",
        "//pkg/storage/enginepb",
        "//pkg/util/hlc",
        "@com_github_cockroachdb_errors//:errors",
    ],
)

proto_library(
    name = "kvserverpb_proto",
    srcs = [
        "internal_raft.proto",
        "lease_status.proto",
        "proposer_kv.proto",
        "raft.proto",
        "range_log.proto",
        "state.proto",
    ],
    strip_import_prefix = "/pkg",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/kv/kvpb:kvpb_proto",
        "//pkg/kv/kvserver/kvflowcontrol/kvflowcontrolpb:kvflowcontrolpb_proto",
        "//pkg/kv/kvserver/liveness/livenesspb:livenesspb_proto",
        "//pkg/kv/kvserver/readsummary/rspb:rspb_proto",
        "//pkg/raft/raftpb:raftpb_proto",
        "//pkg/roachpb:roachpb_proto",
        "//pkg/storage/enginepb:enginepb_proto",
        "//pkg/util/hlc:hlc_proto",
        "//pkg/util/tracing/tracingpb:tracingpb_proto",
        "@com_github_cockroachdb_errors//errorspb:errorspb_proto",
        "@com_github_gogo_protobuf//gogoproto:gogo_proto",
        "@com_google_protobuf//:timestamp_proto",
    ],
)

go_proto_library(
    name = "kvserverpb_go_proto",
    compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvserverpb",
    proto = ":kvserverpb_proto",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver/closedts/ctpb",  # keep
        "//pkg/kv/kvserver/kvflowcontrol/kvflowcontrolpb",
        "//pkg/kv/kvserver/liveness/livenesspb",
        "//pkg/kv/kvserver/readsummary/rspb",
        "//pkg/raft/raftpb",
        "//pkg/roachpb",
        "//pkg/storage/enginepb",
        "//pkg/util/hlc",
        "//pkg/util/tracing/tracingpb",
        "//pkg/util/uuid",  # keep
        "@com_github_cockroachdb_errors//errorspb",
        "@com_github_gogo_protobuf//gogoproto",
    ],
)
